package servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author Miss Chen
 * @version 1.0
 * @date 2024年08月30日15:13
 */
@WebServlet("/showAddEmp")
public class ShowAddEmpServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        // 告诉浏览器以什么样的格式对响应的数据进行解析
        response.setContentType("text/html;charset=utf-8");
        PrintWriter out=response.getWriter();
        out.print("<!DOCTYPE html>");
        out.print("<html lang='en'>");
        out.print("<head><meta charset='UTF-8'><title>添加员工信息</title></head>");
        out.print("<body>");
        out.print("    <h1>添加员工信息</h1>");
        out.print("    <a href='findAll'>员工列表</a>");
        out.print("    <form action='addEmp' method='get'>");
        out.print("       姓名: <input type='text' name='name'><br>");
        out.print("        工资: <input type='text' name='salary'><br>");
        out.print("        性别: <input type='radio' name='gender' value='man'>男");
        out.print("        <input type='radio' name='gender' value='woman'>女");
        out.print("        <br>");
        out.print("        学历:");
        out.print("        <select name='edu' >");
        out.print("            <option value='-1'>请选择</option>");
        out.print("            <option value='1'>高中</option>");
        out.print("            <option value='2'>大专</option>");
        out.print("            <option value='3'>本科</option>");
        out.print("            <option value='4'>研究生</option>");
        out.print("        </select>");
        out.print("        <br>");
        out.print("        兴趣");
        out.print("        <input type='checkbox' name='hobbies' value='eat'>吃饭");
        out.print("        <input type='checkbox' name='hobbies' value='sleep'>睡觉");
        out.print("        <input type='checkbox' name='hobbies' value='beat'>打豆豆");
        out.print("        <br>");
        out.print("        <input type='submit' value='添加'>");
        out.print("    </form>");
        out.print("</body>");
        out.print("</html>");
    }
}
